export function initFormListWidth(thisObj, formList) {
  let clientWidth = thisObj.clientWidth - 250
  // thisObj.$store.state.setting.sidebar.opened
  // if (thisObj.$store.state.setting.sidebar.opened) {
  //   clientWidth = clientWidth - 140
  // }
  // console.log('this.$store.state.setting.sidebar.opened',thisObj.$store.state.setting.sidebar.opened)
  console.log('thisObj.initSrcObj.initSrcOpenWidth',thisObj.initSrcObj.initSrcOpenWidth)
  if (thisObj.initSrcObj.initSrcOpenWidth !== undefined) {
    clientWidth = thisObj.initSrcObj.initSrcOpenWidth - 200
  }
  // const panelWidth = thisObj.initLoadObj.panelWidth === undefined ? thisObj.initLoadObj.defPanelWidth : thisObj.initLoadObj.panelWidth
  const panelWidth = thisObj.initLoadObj.defPanelWidth
  const panelRealWidth = clientWidth * (panelWidth / 100)
  const colData = formList.colData
  for (const colKey in colData) {
    const colKeyList = colData[colKey]
    for (const colIdx in colKeyList) {
      const formItem = colKeyList[colIdx]
      const required = thisObj.lazyFormRules[formItem.model][0].required
      const itemWidth = getTagItemWidth(panelRealWidth, formItem, required)
      formItem.inputStyle = itemWidth
      // const divStyle = {}
      // divStyle.white-space= normal
      // divStyle.word-break= break-all;
      // divStyle.overflow= hidden;
      formItem.divStyle = itemWidth
      // console.log(colKey,'formItem.inputStyle',panelRealWidth,panelWidth)
    }
  }
  return formList
}
export function getTagItemWidth(panelWidth, formItem, required) {
  return getTextWidth(panelWidth, formItem, required)
}
export function getTextWidth(panelWidth, formItem, required) {
  const labelLen = 15
  const itemLabelLength = formItem.label.length
  const tagNum = 24 / formItem.colNum
  let tagWidth = panelWidth / 2
  if (tagNum === 1) {
    /** 只有一个文本 */
    // tagWidth = panelWidth - itemLabelLength * labelLen + 80
    tagWidth = panelWidth + 20
  } else if (tagNum === 2) {
    tagWidth = (panelWidth / tagNum) - itemLabelLength * labelLen
  } else if (tagNum === 3) {
    // 4*15 = 60
    tagWidth = (panelWidth / tagNum) - itemLabelLength * labelLen
  } else {
    tagWidth = (panelWidth / tagNum) - itemLabelLength * labelLen
  }
  if (required) {
    tagWidth = tagWidth - 10
  }
  return 'width:' + tagWidth + 'px;'
}
export function getTextIconWidth(screeWidth, formItem) {

}

export function getSelectWidth(screeWidth, formItem) {

}
export function getNumberWidth(screeWidth, formItem) {

}
